 define(function(require, exports,modules){

  var $ = require('../lib/jquery');  // jquery模块
  var bs = require('../lib/bootstrap-3.0.0-dist/dist/js/bootstrap');
  var _ = require('../main');  // main模块
  var bsm = require('../lib/bootstrap-treeview.min');
  var jqc = require('../lib/jquery.contextify.min');
  var commonurl=_.getUrl();
  var ticket = _.getTicket();

  // staticData();

      $.ajax({
              url:commonurl+"nginx/getSystem",
              type: 'GET', 
              headers: {"Authorization":ticket},
              Accept: 'application/json',
              success: function(json){
              var parameters=json;
              filePath=_.getFilePath(parameters[0].value);
              $.ajax({ 
                    url: commonurl+"nginx/errorConf?address="+filePath,
                    type: 'GET',
                    headers: {"Authorization":ticket}, 
                    success: function(json){
                      var confText=json;
                      $("#cuowuLog").val(confText); 
                    },
                    error:function(){
                      $("#cuowuLog").val("文件加载失败");
                    }
                  });
              $.ajax({ 
                    url: commonurl+"nginx/contentLog?address="+filePath,
                    type: 'GET',
                    headers: {"Authorization":ticket}, 
                    success: function(json){
                      var confText=json;
                      $("#lianjieLog").val(confText); 
                    },
                    error:function(){
                      $("#lianjieLog").val("文件加载失败");
                    }
                  });
              },
              error:function(json){
                confirm("提示","系统出错路径检查不到，检查数据库路径是否正确");
              }
            });
    $(".btn_reset").on("click",function(){
    $.ajax({ 
    url: commonurl+"nginx/copyErrorFile?address="+filePath,
    type: 'GET',
    headers: {"Authorization":ticket}, 
    contentType: 'application/json; charset=utf-8',
    success: function(json){
        alert("备份清空成功");
        setTimeout(function(){  //使用  setTimeout（）方法设定定时1000毫秒
            window.location.reload();//页面刷新
        },1000);;
      },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert("系统错误"+errorThrown);
            }
    });
  })
    $(".btn_reset1").on("click",function(){
    $.ajax({ 
    url: commonurl+"nginx/copyErrorFile?address="+filePath,
    type: 'GET',
    headers: {"Authorization":ticket}, 
    contentType: 'application/json; charset=utf-8',
    success: function(json){
        alert("备份清空成功");
        setTimeout(function(){  //使用  setTimeout（）方法设定定时1000毫秒
            window.location.reload();//页面刷新
        },1000);;
      },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert("系统错误"+errorThrown);
            }
    });
  })
    /*右键菜单*/
	  var options = {items:[
	  {header: '菜单'},
	  {text: '新增', href: '#'},
	  {text: '删除', onclick: function(e) {
	    alert('删除 ');
	  }},
	  {divider: true},//下划线
	  {text: '播放', onclick:function(e){
	  	    var arr = $('#tree').treeview('getSelected');
            for (var key in arr) {
                if(arr[key].id=="00001"){
                	$("#video").attr("src","../video/09.mp4");
                }
                 if(arr[key].id=="00002"){
                	$("#video").attr("src","../video/08.mp4");
                }
            }

	  	}
	  } 
	]}
	$('#tree').contextify(options);

  //   //ajax拿到安装路径
  //   function staticData(){
  //   //ajax数据交互 
  //     $.ajax({
  //             url:commonurl+"system/getSystem",
  //             type: 'GET', 
  //             Accept: 'application/json',
  //             success: function(json){
  //               var parameters=json;
  //             filePath=_.getFilePath(parameters[0].value); 
  //             },
  //             error:function(json){
  //               confirm("提示","系统出错路径检查不到，检查数据库路径是否正确");
  //             }
  //           });
  // }

/*右键菜单*/
});


